home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Frameworks / Sprocket Framework DR2 / Sprocket Framework Interfaces / DocumentWindow.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-12  |  2.4 KB  |  110 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        Document.h
  3.  
  4.     Contains:    An abstract base class for a document.
  5.                 (NOTE: It isn’t finished yet!)
  6.                 
  7.     Written by: Dave Falkenburg
  8.     
  9.     Copyright:    © 1994-95 by Dave Falkenburg, all rights reserved.
  10.  
  11.     Change History (most recent first):
  12.      
  13.          <1>     1/24/95    DRF        First checked in.
  14.  */
  15.  
  16. #ifndef    _DOCUMENTWINDOW_
  17. #define    _DOCUMENTWINDOW_
  18.  
  19. #include <GXPrinting.h>
  20.  
  21. #include "File.h"
  22. #include "Window.h"
  23.  
  24. class    TDocumentWindow    :    public    TWindow
  25. {
  26. protected:
  27. //    TDocument cannot be directly instantiated, you must override it
  28.                             TDocumentWindow(FSSpecPtr theContainer = NULL);
  29.  
  30. public:
  31.     virtual                    ~TDocumentWindow();
  32.  
  33. //    ---------------- METHODS WHICH MUST BE OVERRIDDEN ---------------
  34.  
  35. //    Document specific methods which must be overridden.
  36.     
  37.  
  38.     virtual void            DrawCurrentPage(void);
  39.     
  40.     virtual OSErr            WriteDocumentDataFork(void) = 0;
  41.     virtual OSErr            WriteDocumentResourceFork(void) = 0;
  42.  
  43. //    ---------------- METHODS WHICH MAY BE OVERRIDDEN ----------------
  44.  
  45.     virtual void            Activate(Boolean activating);
  46.  
  47.  
  48. //    Menu command handler: You override this method to handle any
  49. //    content-specific commands. Call through this inherited method
  50. //    for handling default things like closing, saving, and printing.
  51.  
  52.     virtual    Boolean            DoCommand(CommandID theCommand);
  53.  
  54. //    Some default actions we can perform on the document
  55.  
  56.     virtual Boolean            CanClose(Boolean quitting);
  57.     virtual Boolean            Close(void);
  58.     virtual Boolean            DeleteAfterClose(void);
  59.     
  60.     virtual OSErr            Save(void);                                /* = 0 */
  61.     virtual OSErr            SaveAs(void);                            /* = 0 */
  62.     virtual OSErr            Revert(void);                            /* = 0 */
  63.     
  64.     virtual void            PageSetup(Boolean useCustomPageSetup);
  65.     virtual OSErr            Print(Boolean usePrintJobDialog);
  66.     
  67.     virtual    OSErr            QDPrintLoop(void);
  68.     virtual    OSErr            GXPrintLoop(void);
  69.  
  70.  
  71.  
  72. protected:
  73.  
  74.     TFile*                    fBackingFile;
  75.     TFile*                    fTemporaryFile;
  76.     
  77.     gxJob                    fPrintJob;
  78.     THPrint                    fPrintRecord;
  79.     TDynamicArray*            fPageFormats;        // stored type is a gxFormat
  80.     
  81.     Boolean                    fDirty;
  82.     Boolean                    fHasBeenSaved;
  83.     Boolean                    fHasNewEditions;
  84.     Boolean                    fCanPrint;
  85.     
  86.     Str255                    fDocumentName;
  87.     Str255                    fDocumentKind;
  88.     
  89.     long                    fNumOfPages;
  90.     long                    fCurrentPage;
  91.  
  92.  
  93. public:
  94.     static Boolean            CloseAllDocuments(Boolean quitting);
  95.     
  96. private:
  97.     static TDynamicArray    fgActiveDocuments;
  98. };
  99.  
  100.  
  101. typedef struct GXPrintData
  102. {
  103.     gxRectangle        pageArea;                // the Page rectangle
  104.     gxViewPort        printViewPort;            // the ViewPort we're printing with
  105. } GXPrintData, *GXPrintDataPtr;
  106.  
  107.  
  108.  
  109. #endif
  110.